﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GuiNetE
{
    public partial class FormIn : Form
    {
        public FormIn()
        {
            InitializeComponent();
        }
        public FormIn(ref int tal)
        {
            InitializeComponent();
            switch(this.ShowDialog()){
                case DialogResult.OK:
                    try
                    {
                        tal = Convert.ToInt32(this.TextBoxTal.Text);
                        MessageBox.Show(tal.ToString(), "Inmatat:");
                    }
                    catch
                    {
                        MessageBox.Show("Felaktig inmatning!", "Error");
                        tal = 0;
                    }
                    
                    break;
                case DialogResult.Cancel:
                    break;
                default:
                    break;
            }
            
        }

        private void ButtonOk_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void ButtonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
